package com.b.vo;

import java.util.List;

public class PageVo<T> {
    private final int pageNum;
    private final int total;
    private final int pageSize;
    private final int pages;
    private final int prePage;
    private final int nextPage;
    private final int startRecord;

    public PageVo(int pageNum, int total, int pageSize) {
        this.pageNum = pageNum;
        this.total = total;
        this.pageSize = pageSize;
        this.pages=total%pageSize==0?total/pageSize:total/pageSize+1;
        this.prePage=pageNum==1?1:pageNum-1;
        this.nextPage=prePage==pages?pages:pageNum+1;
        this.startRecord=(pageNum-1)*pageSize;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public int getPageNum() {
        return pageNum;
    }

    public int getTotal() {
        return total;
    }

    public int getPageSize() {
        return pageSize;
    }

    public int getPages() {
        return pages;
    }

    public int getPrePage() {
        return prePage;
    }

    public int getNextPage() {
        return nextPage;
    }

    public int getStartRecord() {
        return startRecord;
    }

    public List<T> getList() {
        return list;
    }

    private List<T> list;

}
